#include "processBar.h"
#include <iostream>
#include <iomanip>

void processBar::work(int rate)
{
	if(rate<0 || rate>100)
		return;

	std::cout<<"["<<_buff<<"]";
	std::cout<<"["<<rate<<"%"<<"]";
	std::cout<<"["<<_sign[rate%_sign.size()]<<"]\r";	
	std::cout<<std::flush;
	
	_buff[rate]=_ch;
	if(rate+1<100)
		_buff[rate+1]='>';

}

void processBar::clear()
{
	_buff.clear();
	_buff.resize(100);
}
